<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .btn{
        display: inline-block;
        line-height: 1;
        white-space: nowrap;
        cursor: pointer;
        color: #409eff;
        background: #ecf5ff;
        border-color: #b3d8ff;
        text-align: center;
        box-sizing: border-box;
        padding: 12px 20px;
        font-size: 14px;
        border-radius: 4px;
    }
</style>
<body>
    <script src="/js/vue.js"></script>
    <div id ="app">
        <counter inline-template>
            <button @click="num++">点击{{num}}次</button>
        </counter>
        <counter inline-template>
            <span class="btn"@click="num++">计数{{num}}次</span>
        </counter>
    </div>
    
    <script>
        Vue.component('counter',{
        data(){
            return{
                num:0
            }  
        },
            template:'<button @click="num++">点击{{num}}次</button>'
    })
       let app =new Vue({
         el:"#app"
    })
    </script>  
</body>
</html>